import { defineStore } from "pinia";
import axios from "axios";

export const useUsersStore = defineStore("home", {
  state() {
    return {
      active: 0,
      channels: [],
      show: false,
      channelsId: 1,
      allChannels: [],
    };
  },
  actions: {
    //获取我的频道数据
    getUserChannels() {
      axios.get("/user/channels").then((res) => {
        // console.log(res);
        this.channels = res.data;
      });
    },
    //获取所有频道
    getAllChannels() {
      axios.get("/channels").then((res) => {
        this.allChannels = res.data;
      });
    },
  },
});
